#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;
    int a=0,b=0,c=0;
    int a_total=0,b_total=0,c_total=0,all_total=0;
    for (int i = 0; i < n; i++)
    {
        cin >> a >> b >> c;
        a_total += a;
        b_total += b;
        c_total += c;
        all_total += a + b + c;
    }
    cout << a_total << " " << b_total << " " << c_total << " " << all_total;
    
    return 0;
}